home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Adobe Graphics & Publishing SDK 1996 December
/
Adobe Graphics & Publishing SDK 1996 December.iso
/
pc
/
pm65sdk
/
sourcecode
/
c_language
/
loadf
/
common
/
main.cpp
< prev
Wrap
C/C++ Source or Header
|
1996-09-05
|
5KB
|
252 lines
/*
*--- main.cpp ----------------------------------------------------------
* Copyright (c) 1992-96 Adobe Systems, Inc. All rights reserved.
*
* PageMaker plug-in.
*-----------------------------------------------------------------------
*/
/* ---------------- PageMaker SDK include files ---------------- */
#include "PMPlugin.h"
/* ---------------- Plug-in include files ---------------- */
#include "ExportF.h"
#ifdef MACINTOSH
#include "WinTypes.h"
#endif
/* ---------------- Cross-platform include files ---------------- */
#include <string.h>
#include <stdio.h>
/* ---------------- Platform specific include files ---------------- */
#ifdef MACINTOSH
#include <types.h>
#ifndef powerc
#include <A4Stuff.h>
#include <SetUpA4.h>
#endif
#else
#include <windows.h>
#endif
/* ---------------- Type definitions ---------------- */
/* ---------------- Definitions ---------------- */
#define SUCCESS 1
#define FAILURE 0
#define STAYINMEMORY -1
/* ---------------- PageMaker (New)SDK include files ---------------- */
#include "CIInterfaceManager.h"
#include "PMInterfaceIDs.h"
#include "CICommandsAndQueries.h"
/* ---------------- Function declarations ---------------- */
#ifdef MACINTOSH
#ifdef powerc
#pragma export on
#endif
PMXErr main(PMMessage *pMsg);
#ifdef powerc
#pragma export off
#endif
#else
BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID pReserved);
#endif
PMXErr DoInvoke( PMMessage *pMsg );
PMXErr DoLoad(PMMessage* pMsg);
PMXErr DoRegister(PMMessage* pMsg);
PMXErr DoInvoke(PMMessage* pMsg);
PMXErr DoEvent(PMMessage* pMsg);
PMXErr DoSysEvent(PMMessage* pMsg);
PMXErr DoAcquireInterface(PMMessage* pMsg);
PMXErr DoReleaseInterface( PMMessage *pMsg );
PMXErr DoUnload(PMMessage* pMsg);
PMXErr DoShutdown(PMMessage* pMsg);
PMXErr DoCleanup(PMMessage* pMsg);
/* ---------------- Globals ---------------- */
sPMParamBlockPtr thePB = NULL;
CICommandQuery *gpCmdQry = (CICommandQuery *)NULL;
#ifdef WINDOWS
HINSTANCE ghDLL;
BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID pReserved)
{
ghDLL = hDLL;
return TRUE;
}
#endif
/*
*--- main --------------------------------------------------------------------
* Entry point for plug-in control tasks.
*-----------------------------------------------------------------------------
*/
PMXErr main(PMMessage *pMsg)
{
PMXErr result;
#if __MWERKS__ && __MC68K__
long oldA4 = SetCurrentA4();
RememberA4();
#endif
CIInterfaceManager *pIntfMgr = pMsg->pInterfaceMgr;
switch ( pMsg->opCode ) {
case kPMLoad:
result = DoLoad(pMsg);
break;
case kPMRegister:
result = DoRegister(pMsg);
break;
case kPMInvoke:
result = DoInvoke(pMsg);
break;
case kPMEvent:
result = DoEvent(pMsg);
break;
case kPMSysEvent:
result = DoSysEvent(pMsg);
break;
case kPMAcquireInterface:
result = DoAcquireInterface(pMsg);
break;
case kPMReleaseInterface:
result = DoReleaseInterface(pMsg);
break;
case kPMUnload:
result = DoUnload(pMsg);
break;
case kPMShutdown:
result = DoShutdown(pMsg);
break;
case kPMCleanup:
result = DoCleanup(pMsg);
break;
default:
result = 0;
}
#if __MWERKS__ && __MC68K__
SetA4(oldA4);
#endif
return result;
}
typedef PMXErr (MYCONVERT)(kUnits, float, kUnits, char *, float *, size_t *, PMBool);
PMXErr DoInvoke( PMMessage *pMsg )
{
PMXErr result;
MYCONVERT *pPMInterface;
if (!pMsg)
{
return CQ_FAILURE;
}
CIInterfaceManager *pIntfMgr = pMsg->pInterfaceMgr;
if (!pIntfMgr)
{
return CQ_FAILURE;
}
pIntfMgr->AcquirePMInterface((char *)PIConvertName, (LPVOID *)&pPMInterface);
if (!pIntfMgr)
{
return CQ_FAILURE;
}
if (!pIntfMgr->AcquirePMInterface((unsigned long)PMIID_CMDQRY, (LPVOID *)&gpCmdQry))
{
gpCmdQry->Retrieve (&thePB);
if (thePB)
{
PMErr error;
char buff[256];
size_t buffSize;
float dSize;
error = PBTextCommand(thePB, kXRSPointer, "newstory 1i 1i");
error = (pPMInterface)(kInches, (float)1, kMillimeters, buff, &dSize, &buffSize, true);
error = PBBinCommand(thePB, pm_textenter, kXRSPointer, buff, buffSize);
error = PBTextCommand(thePB, kXRSPointer, "view 100");
}
pIntfMgr->ReleasePMInterface((LPVOID *)gpCmdQry);
}
pIntfMgr->ReleasePMInterface((char *)PIConvertName, (LPVOID *)&pPMInterface);
return CQ_SUCCESS;
}
PMXErr DoLoad(PMMessage* pMsg)
{
#pragma unused (pMsg)
return CQ_SUCCESS;
}
PMXErr DoRegister(PMMessage* pMsg)
{
#pragma unused (pMsg)
return CQ_SUCCESS;
}
PMXErr DoEvent(PMMessage* pMsg)
{
#pragma unused (pMsg)
return CQ_SUCCESS;
}
PMXErr DoSysEvent(PMMessage* pMsg)
{
#pragma unused (pMsg)
return CQ_SUCCESS;
}
PMXErr DoAcquireInterface(PMMessage* pMsg)
{
#pragma unused (pMsg)
return CQ_SUCCESS;
}
PMXErr DoReleaseInterface(PMMessage* pMsg)
{
#pragma unused (pMsg)
return CQ_SUCCESS;
}
PMXErr DoUnload(PMMessage* pMsg)
{
#pragma unused (pMsg)
return CQ_SUCCESS;
}
PMXErr DoShutdown(PMMessage* pMsg)
{
#pragma unused (pMsg)
return CQ_SUCCESS;
}
PMErr DoCleanup(PMMessage* pMsg)
{
#pragma unused (pMsg)
return CQ_SUCCESS;
}